TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

Resume and analysis data

Prisma Resume and Analysis models: storage, relations, JSON fields, and how services read and write them.

Repository layout#

The Resume and Analysis data models are defined in the Prisma schema and consumed by backend services and routes. The relevant files include:

  • Prisma schema defining models and indexes
  • Services orchestrating resume processing and analysis
  • Routes exposing endpoints for resume analysis and tailored resume generation
  • Pydantic schemas validating and structuring analysis outputs

Building blocks#

  • Resume model
  • Fields: id, userId, customName, rawText, uploadDate, showInCentral, source, isMaster, parentId
  • Relations: belongs to User, optional Analysis, parent-child relationship via parentId with SetNull on child delete
  • Indexes: composite index on userId and isMaster
  • Analysis model
  • Fields: id, resumeId (unique), name, email, contact, linkedin, github, blog, portfolio, predictedField, skillsAnalysis (JSON), recommendedRoles (array), and multiple JSON sections (languages, education, workExperience, projects, publications, positionsOfResponsibility, certifications, achievements)
  • Relations: belongs to Resume
  • Timestamps: uploadedAt, updatedAt

These models support:

  • Resume ingestion and storage of raw text
  • Structured analysis outputs persisted as JSON
  • Master resume tracking and tailored resume hierarchy
  • Efficient querying via indexes

How it fits together#

The system processes uploaded resumes, extracts and validates text, performs analysis, and stores structured results. The flow integrates file processing, LLM-based extraction, and persistence.

Resume model#

  • Purpose: Store user-associated resume with raw text and metadata
  • Key fields
  • userId: foreign key to User
  • customName: human-friendly display name
  • rawText: large text content stored as Text
  • uploadDate: creation timestamp
  • showInCentral: visibility flag
  • source: “UPLOADED” or “MANUAL”
  • isMaster: master resume flag
  • parentId: nullable parent for tailored resumes
  • Relationships
  • belongs to User
  • optional Analysis
  • parent-child via parentId with SetNull on child delete
  • Indexing
  • Composite index on (userId, isMaster) for efficient lookups

Analysis model#

  • Purpose: Persist structured analysis results with flexible JSON sections
  • Core fields
  • Personal info: name, email, contact
  • Professional links: linkedin, github, blog, portfolio
  • Predicted field: predictedField
  • Skills: skillsAnalysis (JSON)
  • Recommended roles: recommendedRoles (array)
  • Sections: languages, education, workExperience, projects, publications, positionsOfResponsibility, certifications, achievements (all JSON)
  • Timestamps
  • uploadedAt: initial insertion
  • updatedAt: last modification

Parent-Child relationship for tailored resumes#

  • Tailored resumes are children of a master resume
  • Deletion policy: child delete sets parentId to NULL (SetNull)
  • Master resume tracking: isMaster flag distinguishes primary resume per user
  • Central visibility: showInCentral flag controls central listing

JSON field usage and structured data#

  • JSON fields enable flexible storage of complex nested structures (e.g., lists of entries, proficiency data)
  • Validation and normalization are handled by Pydantic models:
  • ComprehensiveAnalysisData: aggregates all analysis sections
  • Individual section validators coerce text and lists consistently
  • Typical JSON sections include:
  • skillsAnalysis: list of skill-proficiency pairs
  • recommendedRoles: array of role names
  • languages, education, workExperience, projects, publications, positionsOfResponsibility, certifications, achievements: arrays of normalized entries

Data lifecycle management#

  • Ingestion: file upload processed into raw text
  • Validation: checks for supported formats and resume keywords
  • Analysis: LLM-driven extraction into structured JSON
  • Persistence: Resume with rawText and Analysis with JSON sections
  • Retrieval: composite index supports efficient user and master resume queries

Resume versioning patterns and master resume tracking#

  • Master resume: identified by isMaster flag per user
  • Tailored resumes: children of a master resume via parentId
  • Versioning: achieved by creating new child resumes while preserving the master; deletion of a tailored resume does not affect the master (SetNull on parentId)
  • Central listing: controlled by showInCentral flag

Analysis result storage mechanisms#

  • Results are stored as JSON in dedicated fields for each section
  • A unified ComprehensiveAnalysisData model aggregates all sections for downstream use
  • Enrichment and regeneration workflows operate on this structured JSON

Data validation rules#

  • Resume validation ensures presence of typical resume keywords
  • Pydantic models validate and normalize JSON structures
  • Portfolio link aliasing accommodates varied LLM outputs

Text search capabilities#

  • rawText is stored as Text for large content
  • No explicit text search index is defined in the schema; consider adding GIN or trigram indexes for full-text search if needed
  • Current indexing focuses on userId and isMaster for filtering master resumes per user

Dependencies#

The Resume and Analysis models depend on:

  • Prisma schema for database definitions and indexes
  • Backend services for processing and analysis
  • Pydantic models for validation and normalization
  • Routes for endpoint orchestration

Performance#

  • Large text fields
  • rawText is stored as Text; consider partitioning or external storage for very large documents
  • Full-text search: add GIN/trigram indexes if frequent text searches are required
  • Indexing
  • Composite index on (userId, isMaster) optimizes fetching master resumes per user
  • Consider additional indexes for frequent filters (e.g., source, uploadDate)
  • JSON fields
  • JSON queries may be slower than relational joins; denormalize selectively if needed
  • Use targeted projections to minimize JSON payload sizes
  • LLM processing
  • Batch processing and caching can reduce latency
  • Monitor LLM availability and handle fallbacks gracefully
  • Cascading deletes
  • Tailored resumes use SetNull on parentId; clean up of unused records

[No sources needed since this section provides general guidance]

Troubleshooting#

  • Unsupported file type or processing errors
  • The processor returns None for unsupported types; accept only TXT, MD, PDF, or DOCX
  • Validation failures
  • Resume must contain typical resume keywords; otherwise rejected
  • Pydantic validation errors indicate malformed LLM outputs; review extracted keys and aliases
  • LLM unavailability
  • Empty or non-dictionary results lead to service errors; verify LLM configuration and availability
  • Portfolio aliasing
  • Portfolio field mapping handles various LLM output keys; keep alias handling consistent